// var result = window.confirm('luojianming')
// console.log(result);
const a = 123;
// a = 1234;//量不可重复赋值
console.log(a);
{
    const b = 111;
    console.log(a);
    console.log(b);
}
// console.log(b);//const 是块级作用域，所以b未定义
var obj = new Object();
var obj = { name: 'luojianming', age: 18 };
console.log(obj["name"], obj.name);
var arr = ['罗建明', 111];
var arr = new Array('luojianming', 666)
console.log(arr);
console.log(Number.MAX_SAFE_INTEGER);
console.log(Number.MAX_VALUE)
var name = '罗建明';
var age = 18;
console.log(`姓名${name}年龄${age}岁`);//es6写法，模板字符串
console.log(Number(null));
console.log(Number(undefined));
console.log(undefined === null); //null与undefined值相等，数据类型不相同    
var c = null;
var b = undefined;
console.log(typeof c);
console.log(typeof b);
var num1 = new Number(123);
var num2 = 123;
console.log(typeof num1);
console.log(typeof num2);
var str = '1234';
console.log(str.charAt(0));

//构造函数
var fun = function (name, age) {
    this.name = name;
    this.age = age;
}
function fun1(name, age) {
    this.name = name;
    this.age = age;
}
var myfun = new fun('罗建明', 18);
var myfun1 = new fun1('luo', 20);
console.log(myfun, myfun1);
// alert('hello\nworld')
var my = str + 12;
var num1 = 1;
var num2 = 2;
// 两个数字交换算法
// num1 = num1 + num2;
// num2 = num1 - num2;
// num1 = num1 - num2;
console.log(num1);


//js中逻辑与运算规则：如果运算符左边为真，直接返回右边的值；如果运算符左边为假，直接返回左边的值。
console.log(1 && 0);
console.log(1 && 2);
console.log(0 && 2);
console.log(0 && 0);

//js中逻辑或运算规则：如果运算符左边为真，直接返回左边的值；如果运算符左边为假，直接返回右边的值。
console.log(1 || 0);
console.log(1 || 2);
console.log(0 || 2);
console.log(0 || 0);

//提示输入框 prompt
// var myNumber = prompt("请输入数字");
// console.log(myNumber)


